package com.adopapa.nezhacloud.innerapi.factory;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.stereotype.Component;

import com.adopapa.nezhacloud.common.RestResponse;
import com.adopapa.nezhacloud.innerapi.api.InnerUserInfoService;

/**
 * 用户服务降级处理
 */
@Component
public class InnerUserInfoFallbackFactory extends BaseFallbackFactory<InnerUserInfoService> {

	@Override
	public InnerUserInfoService create(Throwable cause) {
		logger.error("InnerUserInfoService 服务调用失败");
		logger.error(ExceptionUtils.getStackTrace(cause));
		return new InnerUserInfoService() {
			@Override
			public RestResponse getUserInfo(String userId) {
				return RestResponse.error(cause);
			}
		};
	}
}